﻿using Css_Shop.Models.Database;
using Microsoft.AspNetCore.Mvc;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Css_Shop.Controllers
{
    [Route("api/[controller]/[action]")]
    [ApiController]
    public class UserController : Controller
    {
        private readonly Css_shopContext _context;
        public UserController(Css_shopContext context)
        {
            _context = context;
        }

        // 查询数据库中所有用户信息
        // 请求方法POST
        /// <summary>
        /// 查询所有用户
        /// </summary>
        [HttpPost]
        //GetUsers方法
        public List<User> GetUsers()
        {
            return _context.Users.ToList();
        }
    }
}
